/*
 * Copyright (c) 2021. www.vtuzx.com Inc. All Rights Reserved
 */
package com.vtuzx.kingdee.xqc_api.dao;

import com.vtuzx.core.bean.dto.VtuzxMap;
import com.vtuzx.core.utils.VtuzxUtil;
import com.vtuzx.fast.dao.master.FastConfigDao;
import org.bson.Document;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.stereotype.Component;

/**
 * ConfigDao, 引入Fast框架时必须重写
 */
@Component
public class ConfigDao extends FastConfigDao {

    public void setPrintFlag(boolean printFlag) {
        updateOne(Criteria.where("type").is("printFlag"), new Document("value", printFlag));
    }
    public boolean getPrintFlag() {
        Document doc = findOne(Criteria.where("type").is("printFlag"));
        if (doc == null) return false;
        return VtuzxUtil.getBoolean(doc, "value");
    }
}
